package cn.yunchongbao.charging.order.controller;

import cn.yunchongbao.charging.common.pojo.JsonResult;
import cn.yunchongbao.charging.order.pojo.param.OrderAddParam;
import cn.yunchongbao.charging.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/order")
@RestController
@Api(tags = "订单接口")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("create")
    @ApiOperation("创建订单")
    public JsonResult createOrder(@RequestBody OrderAddParam orderAddParam){
        log.debug("订单创建入参：{}", orderAddParam);
        String orderNo = orderService.createOrder(orderAddParam);
        return JsonResult.ok(orderNo,"订单创建成功");
    }
}
